package com.example.ojcommon.enums;

import lombok.Getter;

@Getter
public enum DifficultyEnum {
    SIMPLE("简单", 1),
    MEDIUNM("中等", 2),
    DIFFICULT("困难", 3);

    private final String text;

    private final Integer value;

    DifficultyEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }

    public static String valueOf(Integer value) {
        if (value == null) {
            return null;
        }
        for (DifficultyEnum difficultyEnum : DifficultyEnum.values()) {
            if (difficultyEnum.getValue().equals(value)) {
                return difficultyEnum.text;
            }
        }
        return null;
    }
}
